<?php

/**
 * This is the model class for table "jumlahternakayamtelur".
 *
 * The followings are the available columns in table 'jumlahternakayamtelur':
 * @property integer $jta_id
 * @property integer $jta_kec
 * @property integer $jta_peternak
 * @property integer $jta_telur_dewasa
 * @property integer $jta_telur_muda
 * @property integer $jta_telur_anak
 * @property integer $jta_telur_jumlah
 * @property integer $jta_tahun
 *
 * The followings are the available model relations:
 * @property Kecamatan $jtaKec
 */
class Jumlahternakayamtelur extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @return Jumlahternakayamtelur the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'jumlahternakayamtelur';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('jta_kec, jta_peternak, jta_telur_dewasa, jta_telur_muda, jta_telur_anak, jta_telur_jumlah, jta_tahun', 'numerical', 'integerOnly'=>true),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('jta_id, jta_kec, jta_peternak, jta_telur_dewasa, jta_telur_muda, jta_telur_anak, jta_telur_jumlah, jta_tahun', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
			'jtaKec' => array(self::BELONGS_TO, 'Kecamatan', 'jta_kec'),
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'jta_id' => 'Jta',
			'jta_kec' => 'Jta Kec',
			'jta_peternak' => 'Jumlah Peternak',
			'jta_telur_dewasa' => 'Ayam Ras Telur Dewasa',
			'jta_telur_muda' => 'Ayam Ras Telur Muda',
			'jta_telur_anak' => 'Ayam Ras Telur Anak',
			'jta_telur_jumlah' => 'Jumlah Ayam Ras Telur',
			'jta_tahun' => 'Tahun',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('jta_id',$this->jta_id);
		$criteria->compare('jta_kec',$this->jta_kec);
		$criteria->compare('jta_peternak',$this->jta_peternak);
		$criteria->compare('jta_telur_dewasa',$this->jta_telur_dewasa);
		$criteria->compare('jta_telur_muda',$this->jta_telur_muda);
		$criteria->compare('jta_telur_anak',$this->jta_telur_anak);
		$criteria->compare('jta_telur_jumlah',$this->jta_telur_jumlah);
		$criteria->compare('jta_tahun',$this->jta_tahun);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}
}